package org.yefei.homeworkday11;

import java.util.Scanner;

public class Admin {
	/*
	 * 更改管理员密码那题： 模拟实现用户密码管理：输入旧的用户名和密码，如果正确，方有权限更新；从键盘获取新的密码，进行更新
	 */
	public String adname;
	public String password;

	public void show() {
		System.out.println("用户名：" + adname + "\t" + "密码：" + password);
	}

	public static void main(String[] args) {
		Admin ad = new Admin();
		ad.adname = "adminstor";
		ad.password = "fan123";
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入旧用户名：");
		String oname = sc.next();
		System.out.println("请输入旧密码：");
		String opw = sc.next();
		if (oname.equals(ad.adname) && opw.equals(ad.password)) {
			System.out.println("请输入新密码");
			ad.password = sc.next();
		} else {
			System.out.println("用户名和密码不匹配！没有权限更新！");
			return;
		}
		ad.show();
	}
}
